//
//  ViewController.swift
//  zhiboxiangmu
//
//  Created by 丁鼎 on 2017/6/18.
//  Copyright © 2017年 丁鼎. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        automaticallyAdjustsScrollViewInsets = false
        
        
        //创建pageview
        //1,获取pageview的frame
        let pageViewFrame = CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)
        
        //2,获取pageView中所有的控制器
        let titles = ["推荐","游  戏","娱乐","趣推荐玩","推荐推荐推荐推荐","游戏","娱乐","趣推玩","推荐","游戏","娱乐","趣玩"]
        
        //3,获取pageview中所有的内容控制器
        var childVcs = [UIViewController]()
        for _ in 0..<titles.count {
            let vc = UIViewController()
            vc.view.backgroundColor = UIColor(red: CGFloat(arc4random_uniform(256))/255.0, green: CGFloat(arc4random_uniform(256))/255.0, blue: CGFloat(arc4random_uniform(256))/255.0, alpha: 1)
            childVcs.append(vc)
        }
        
        //4,样式
        let style = ZBXMPageStyle()
        style.isScrollEnable = true
//        style.isSclae = true
        style.isCoverViewShow = true
        
        let pageview = ZBXMPageView(frame: pageViewFrame, title: titles, style: style, childVcs: childVcs, parentVc: self)
        
        view.addSubview(pageview)
        
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    

}

